.TH std::experimental::ranges::is_permutation 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::experimental::ranges::is_permutation \- std::experimental::ranges::is_permutation

.SH Synopsis
   Defined in header <experimental/ranges/algorithm>
   template< ForwardIterator I1, Sentinel<I1> S1, ForwardIterator I2,
   Sentinel<I2> S2,

             class Pred = ranges::equal_to<>,
             class Proj1 = ranges::identity, class Proj2 =
   ranges::identity >                                                  \fB(1)\fP (ranges TS)
       requires IndirectlyComparable<I1, I2, Pred, Proj1, Proj2>
   bool is_permutation( I1 first1, S1 last1, I2 first2, S2 last2, Pred
   pred = Pred{},

                        Proj1 proj1 = Proj1{}, Proj2 proj2 = Proj2{}
   );
   template< ForwardRange R1, ForwardRange R2, class Pred =
   ranges::equal_to<>,

             class Proj1 = ranges::identity, class Proj2 =
   ranges::identity >
       requires IndirectlyComparable<ranges::iterator_t<R1>,           \fB(2)\fP (ranges TS)
   ranges::iterator_t<R2>,
                                     Pred, Proj1, Proj2>
   bool is_permutation( R1&& r1, R2&& r2, Pred pred = Pred{},

                        Proj1 proj1 = Proj1{}, Proj2 proj2 = Proj2{}
   );
   template< ForwardIterator I1, Sentinel<I1> S1, class I2,

             class Pred = ranges::equal_to<>,
             class Proj1 = ranges::identity, class Proj2 =
   ranges::identity >
       requires ForwardIterator<std::decay_t<I2>> && !Range<I2> &&         (ranges TS)
                IndirectlyComparable<I1, std::decay_t<I2>, Pred,       \fB(3)\fP \fB(deprecated)\fP
   Proj1, Proj2>
   bool is_permutation( I1 first1, S1 last1, I2&& first2_, Pred pred =
   Pred{},

                        Proj1 proj1 = Proj1{}, Proj2 proj2 = Proj2{}
   );
   template< ForwardRange R1, class I2, class Pred =
   ranges::equal_to<>,

             class Proj1 = ranges::identity, class Proj2 =
   ranges::identity >
       requires ForwardIterator<std::decay_t<I2>> && !Range<I2> &&     \fB(4)\fP (ranges TS)
                IndirectlyComparable<ranges::iterator_t<R1>,               \fB(deprecated)\fP
   std::decay_t<I2>, Pred, Proj1, Proj2>
   bool is_permutation( R1&& r1, I2&& first2_, Pred pred = Pred{},

                        Proj1 proj1 = Proj1{}, Proj2 proj2 = Proj2{}
   );

   1) Returns true if there exists a permutation of the elements in range
   [first1, last1) that makes the range equal to [first2, last2), and false otherwise.
   2) Same as \fB(1)\fP, but uses r1 as the first source range and r2 as the second source
   range, as if using ranges::begin(r1) as first1, ranges::end(r1) as last1,
   ranges::begin(r2) as first2, and ranges::end(r2) as last2.
   3) Same as \fB(1)\fP, except that first2 is defined as if by std::decay_t<I2> first2 =
   std::forward<I2>(first2_); and last2 is first2 + (last1 - first1).
   4) Same as \fB(3)\fP, but uses r1 as the first source range, as if using ranges::begin(r1)
   as first1 and ranges::end(r1) as last1.

   Two ranges are considered equal if they have the same number of elements and, for
   every iterator i in the range [first1, last1), ranges::invoke(pred,
   ranges::invoke(proj1, *i), ranges::invoke(proj2, *(first2 + (i - first1)))) is true.

   Notwithstanding the declarations depicted above, the actual number and order of
   template parameters for algorithm declarations is unspecified. Thus, if explicit
   template arguments are used when calling an algorithm, the program is probably
   non-portable.

.SH Parameters

   first1, last1 - the first range of the elements
   r1            - the first range of the elements
   first2, last2 - the second range of the elements
   r2            - the second range of the elements
   first2_       - the beginning of the second range of the elements
   pred          - predicate to apply to the projected elements
   proj1         - projection to apply to the elements in the first range
   proj2         - projection to apply to the elements in the second range

.SH Return value

   true if the range [first1, last1) is a permutation of the range [first2, last2).

.SH Complexity

   At most O(N^2) applications of the predicate and each projection, or exactly N if
   the sequences are already equal, where N = last1 - first1.

   However if SizedSentinel<S1, I1> && SizedSentinel<S2, I2> is satisfied and last1 -
   first1 != last2 - first2, no applications of the predicate and projections are made.

.SH Example

    This section is incomplete
    Reason: no example

.SH See also

   is_permutation   determines if a sequence is a permutation of another sequence
   \fI(C++11)\fP          \fI(function template)\fP
                    generates the next greater lexicographic permutation of a range of
   next_permutation elements
                    \fI(function template)\fP
                    generates the next smaller lexicographic permutation of a range of
   prev_permutation elements
                    \fI(function template)\fP

.SH Category:
     * Todo no example
